import 'package:json_annotation/json_annotation.dart';
import 'package:gzmall_app/model/product.dart';

part 'store.g.dart';

@JsonSerializable()
class Store extends Object {
  @JsonKey(name: 'id')
  int id;

  @JsonKey(name: 'name')
  String name;

  @JsonKey(name: 'avatar')
  String avatar;

  @JsonKey(name: 'province')
  String province;

  @JsonKey(name: 'city')
  String city;

  @JsonKey(name: 'district')
  String district;

  @JsonKey(name: 'phone')
  String phone;

  @JsonKey(name: 'longitude')
  double longitude;

  @JsonKey(name: 'latitude')
  double latitude;

  @JsonKey(name: 'distance')
  dynamic distance;

  @JsonKey(name: 'intro')
  String intro;

  @JsonKey(name: 'spus')
  List<Product> spus;

  @JsonKey(name: 'favorited')
  bool favorited;

  @JsonKey(name: 'area')
  String area;

  @JsonKey(name: 'share_title')
  String shareTitle;

  @JsonKey(name: 'share_content')
  String shareContent;

  @JsonKey(name: 'share_avatar')
  String shareAvatar;

  @JsonKey(name: 'share_url')
  String shareUrl;

  Store(
    this.id,
    this.name,
    this.avatar,
    this.province,
    this.city,
    this.district,
    this.phone,
    this.longitude,
    this.latitude,
    this.distance,
    this.intro,
    this.spus,
    this.favorited,
    this.shareTitle,
    this.shareContent,
    this.shareAvatar,
    this.shareUrl,
  );

  factory Store.fromJson(Map<String, dynamic> srcJson) =>
      _$StoreFromJson(srcJson);
}
